
import { Base } from '../utils/base.js';

class Product extends Base {
    constructor() {
        super();
    }

    getProductList(callBack) {
        var params = {
            url: 'product',
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        }
        this.request(params);
    }

    // 产品详情
    getProductInfo(id, callBack) {
        var params = {
            url: `product/${id}`,
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        }
        this.request(params);
    }

    // 专属卡
    getProductType(scene, callBack) {
        var params = {
            url: `product-type?scene=${scene}`,
            sCallBack: function (res) {
                callBack && callBack(true, res);
            },
            eCallBack: function (res) {
                callBack && callBack(false, res);
            },
        }
        this.request(params);
    }

    //生成分享二维码
    setProductCode(data,callBack){
        var params = {
            url: 'product/setcode',
            type: 'POST',
            data: data,
            sCallBack: function (res) {
                callBack && callBack(res);
            },
            eCallBack: function (res) {
                callBack && callBack(res);
            },
        }
        this.request(params);
    }

}

export { Product };
